# coding=gb2312

import sys

reload(sys)
sys.setdefaultencoding('utf-8')


COLUMNS = ['A', 'B', 'C', 'D',
           'E', 'F', 'G', 'H',
           'I', 'G', 'K', 'L',
           'M', 'N', 'O', 'P',
           'Q', 'R', 'S', 'T',
           'U', 'V', 'W', 'X',
           'Y', 'Z', 'AA', 'AB']


def is_non_wrap(ws, c):
    cell = ws.cell(row=1, column=c)
    if cell.font is not None and cell.font.color is not None:
        if cell.font.color.value == 'FFC00000':
            return True
        else:
            return False


def is_merged(ws, r):
    field_type = ws.cell(row=r, column=2).value
    if field_type is None:
        return True
    else:
        return False


def get_last_non_merged_row(ws):
    mr = ws.max_row + 1
    rtn = 0
    for r in range(2, mr):
        field_type = ws.cell(row=r, column=2).value
        if field_type is not None:
            rtn = r
    return rtn


